package com.qfedu.entity;

import java.util.List;

/**
 * 创建者: QF-SUN
 * 创建时间: 2023/4/4 9:54
 * 描述:
 */
public class PageBean<T> {
    //总条数：从数据库查询商品的数量
    private long totalCount;
    //当前的页数 ：前端传参
    private int pageNum = 1;
    //起始页: 1
    private int startPage = 1;
    //每页条数： 前端传参（可以设置默认值）
    private int pageSize = 2;
    //总页数: Math.ceil(totalCount * 1.0/ pageSize)
    private int totalPage;
    private int endPage;
    private List<T> data;

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(long totalCount) {
        this.totalCount = totalCount;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getStartPage() {
        return startPage;
    }


    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalPage() {
        return (int)Math.ceil(totalCount * 1.0/ pageSize);
    }

    public int getEndPage() {
        return (int)Math.ceil(totalCount * 1.0/ pageSize);
    }

    public static void main(String[] args) {
//        System.out.println(Math.ceil(10 * 1.0/ 7));
    }
}
